package com.neulogistics.contrib.warehouse.infrastructure.persistence.orm.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.neulogistics.contrib.warehouse.domain.model.aggregate.Inventory;
import com.neulogistics.contrib.warehouse.infrastructure.persistence.converter.InventoryEntityPOConverter;
import com.neulogistics.contrib.warehouse.infrastructure.persistence.orm.po.InventoryPO;
import com.neulogistics.contrib.warehouse.infrastructure.persistence.orm.service.IInventoryPOService;
import com.neulogistics.contrib.warehouse.infrastructure.persistence.orm.mapper.InventoryPOMapper;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

/**
* @author Satoshi
* @description 针对表【tb_inventory(库存信息表)】的数据库操作Service实现
* @createDate 2023-06-27 16:00:27
*/
@Service
public class InventoryPOService extends ServiceImpl<InventoryPOMapper, InventoryPO>
    implements IInventoryPOService {


    @Override
    public boolean saveEntityBatch(Collection<Inventory> collection) {
        List<InventoryPO> inventoryPOS =
                collection.stream()
                        .map(InventoryEntityPOConverter::entityToPO).collect(Collectors.toList());


        return saveBatch(inventoryPOS);
    }
}




